package com.hhdys.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.hhdys.service.AccountService;

@Controller
public class AccountAction {
	@Autowired
	private AccountService service;

	@RequestMapping("/account")
	public ModelAndView getSize() {
		System.out.println("enter");
		ModelAndView m = new ModelAndView("index");
		m.addObject("a", service.getListSize());
		String name = service.getAccountName(1);
		String userName = service.getUserName(1);
		System.out.println(name + "," + userName);
		m.addObject("name", name + "," + userName);
		return m;
	}

	@RequestMapping("/index")
	public String getSize(Model model) {
		System.out.println("enterString");
		model.addAttribute("a", service.getListSize());
		return "index";
	}

	public AccountService getService() {
		return service;
	}

	public void setService(AccountService service) {
		this.service = service;
	}
}
